/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package manager;

import entity.Employee;
import session.stateless.EmployeeSessionBeanLocal;

/**
 *
 * @author Vincent
 */
public class EmployeeManager {
    private EmployeeSessionBeanLocal employeeSessionBeanLocal; 
     
    public EmployeeManager() 
    { 
         
    } 
     
     
    public EmployeeManager(EmployeeSessionBeanLocal employeeSessionBeanLocal) 
    { 
        this.employeeSessionBeanLocal = employeeSessionBeanLocal; 
    } 
     
     
     
    public Long verifyLogin(String userName, String password) 
    { 
        Employee employee = employeeSessionBeanLocal.getEmployee(userName); 
         
        if (employee == null) {
            return null; 
        }
        else 
        { 
            if(employee.getPassword().equals(password)){
                return employee.getId();
            } 
            else return null; 
        } 
    }
    
    public Employee find(String userName, String password) 
    { 
        Employee employee = employeeSessionBeanLocal.getEmployee(userName); 
         
        if (employee == null) {
            return null; 
        }
        else 
        { 
            if(employee.getPassword().equals(password)){
                return employee;
            } 
            else return null; 
        } 
    }    
}
